<?php

/*	Vulpes-backend - Web-based managegent for wireless internet providers.
	Copyright (C) 2007,2008 LinFox Serviços em Informática LTDA.

	This file is part of Vulpes-backend.

	Vulpes-backend is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Vulpes-backend is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.

 	Please note that any front-end (client application) that is distributed
	along with Vulpes-backend, such as the Vulpes frontend by LinFox,
	is subject to it's correspending licene. */

require_once 'dao.php';

class schedule_dao extends dao
{
	public $key = 'schedule_id';
	protected $table = 'schedules';

	function __construct()
	{
		parent::__construct();
	}
	
	function fetch_plan($plan_id)
	{
		$schedules = array();
		$sql_schedules = '
			SELECT
				`'.$this->table.'`.*
			FROM `'.$this->table.'`
			INNER JOIN `plans` ON (
				`plans`.`plan_id` = `'.$this->table.'`.`plan_id` )
			WHERE `plans`.`plan_id` = "'.$plan_id.'"';
		$result_schedules = $this->db->query($sql_schedules);
		while ($schedule = $result_schedules->fetchObject($this->model)) {
			$schedules[] = $schedule;
		}
		return $schedules;
	}
}

?>